<template>
  <a-row type="flex" justify="center">
    <a-space :span="4">
      <a-pagination
        size="small"
        show-quick-jumper
        show-less-items
        :pageSizeOptions="page_size_options"
        :pageSize="page_size"
        :show-total="(total_counts) => `共 ${total_counts} 条记录`"
        :default-current="page_current"
        :current="page_current"
        :total="total_counts"
        @change="CurrentPageChange"
      />
    </a-space>
  </a-row>
</template>
<script>
export default {
  props: {
    sort_fields: Array,
    page_current: Number,
    total_counts: Number,
    page_size_default: Number,
    page_size_options: Array,
    page_size: Number,
  },

  data: () => ({}),
  components: {},
  methods: {
    //   分页 start
    SortTypeChange: function (checked) {
      if (checked) {
        this.$store.commit(
          this.$store.state.Namedparent.name + "/ChangeSortType",
          "asc"
        );
      } else {
        this.$store.commit(
          this.$store.state.Namedparent.name + "/ChangeSortType",
          "desc"
        );
      }
    },
    SortFieldChange: function (sortField) {
      console.log("sortField: ", sortField);
      this.$store.commit(
        this.$store.state.Namedparent.name + "/ChangeSortField",
        sortField
      );
    },
    CurrentPageChange: function (currentPage) {
      this.$store.commit(
        this.$store.state.Namedparent.name + "/Changeloading",
        true
      );
      this.$store.commit(
        this.$store.state.Namedparent.name + "/ChangeCurrentPage",
        currentPage
      );
      this.$store.dispatch(this.$store.state.Namedparent.name + "/GetBooks",this.$store.state.qikan.books.searchtype);
    },
    // 分页 end
  },
};
</script>